package com.example.demoboot.mdc;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Random;

public class TxFlow {
    private static final Logger LOGGER = LoggerFactory.getLogger(TxFlow.class);

    private void prepare() {
        LOGGER.info("prepare tx");
    }

    private void handle() {
        LOGGER.info("handle tx");
        try {
            Thread.sleep(new Random().nextInt(4) * 1000);
        } catch (InterruptedException ignored) {
        }
    }

    private void submit() {
        LOGGER.info("submit tx");
    }

    public void run() {
        prepare();
        handle();
        submit();
    }
}